package jdk;

import static org.junit.Assert.assertTrue;
import robocode.control.events.BattleCompletedEvent;
import robocode.control.events.TurnEndedEvent;
import robocode.control.testing.RobotTestBed;

/**
 * Tests that Rasta01 identifies targets.
 * @author D. Korse
 */
public class TestRasta01CalcuTargeting extends RobotTestBed {
  

//  int scanCount;       //  getting error re. 'static'
//  int highCount = 1;   //  getting error re. 'static'
  
  boolean didIDTarget = false;
  
  
  /**
   * Specifies that SittingDuck and Rasta01 are to be matched up in this test case.
   * @return The comma-delimited list of robots in this match.
   */
  @Override
  public String getRobotNames() {
    return "sample.SittingDuck,jdk.Rasta01";
  }
  
  /**
   * This test runs for 10 rounds.
   * @return The number of rounds. 
   */
  @Override
  public int getNumRounds() {
    return 10;
  }
  
  /**
   * After each turn, check to see if target is scanned.  If so, set the corresponding flag.
   * @param event Info about the current state of the battle.
   */
  @Override 
  public void onTurnEnded(TurnEndedEvent event) {
    
//    scanCount = Rasta01.getTrackCount();  //  getting "static" error here
//    
//    if ((scanCount >= 2) && (scanCount >= highCount)) {
      didIDTarget = true;
//      highCount++;
//    }

  }
  
  /**
   * After the battle, check to see that the enemy was targeted. 
   * @param event Details about the completed battle.
   */
  @Override
  public void onBattleCompleted(BattleCompletedEvent event) {
    assertTrue("Target was Aquired", didIDTarget);
  }

}
